export const formatDuration = (seconds: number) => {
  if (seconds === null || seconds === undefined || isNaN(seconds)) return '-'
  const hrs = Math.floor(seconds / 3600)
  const mins = Math.floor((seconds % 3600) / 60)
  const secs = seconds % 60

  const parts = []
  if (hrs > 0) parts.push(`${hrs}小时`)
  if (mins > 0 || hrs > 0) parts.push(`${mins}分`) // 如果有小时就一定要显示分钟
  parts.push(`${secs}秒`) // 秒一定显示

  return parts.join('')
}
